package com.chenfan.ccp.plug.rpc.service;


import java.util.Collection;

/**
 * @author K
 * @date 2021/1/25
 */
public interface ApprovalRemoteService {

    /**
     * 发起审批
     * @param approvalTemplateId 审批模板ID
     * @param useId 发起人ID
     * @param userName 发起人名称
     * @param param 参数, 可能用于回调使用
     * @return
     */
    Long startProcess(Long approvalTemplateId, Long useId, String userName, String param);

    default Long startProcess(Long approvalTemplateId, Long useId, String userName) {
        return startProcess(approvalTemplateId, useId, userName, null);
    }

    /**
     * 撤回审批
     * @param approvalId 审批实例ID
     * @return
     */
    Long revokeApproval(Long approvalId);

    Long revokeApproval(Long approvalId, Long userId, String userName);

    /**
     * 根据状态筛选审批单The push refers to repository [docker.io/daming/testapp]
     * @param approvalUserId 审批状态
     * @param pageNum
     * @param pageSize
     * @return
     */
    String getInstanceStatusList(Long approvalTemplateId, Long approvalUserId, Integer pageNum, Integer pageSize);

    default String getInstanceStatusList(Long approvalTemplateId, Long approvalUserId) {
        return getInstanceStatusList(approvalTemplateId, approvalUserId, 1, Integer.MAX_VALUE);
    }

    String approvalToMap(Collection<Long> approvalIdList);
}
